<template>
  <div class="login-log">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>登录日志</span>
          <el-tag type="info" size="small">
            用户登录记录
          </el-tag>
        </div>
      </template>
      
      <div class="log-content">
        <h3>登录日志功能</h3>
        <p>查看用户登录记录，包括登录时间、IP地址、登录状态等</p>
        <p>会话超时时间：{{ sessionTimeout }}秒</p>
        <el-button @click="goBack">返回系统管理</el-button>
      </div>
    </el-card>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage } from 'element-plus'
import { getConfigStatus } from '@/api/system'

const router = useRouter()

// 登录日志相关配置状态
const sessionTimeout = ref(7200)

// 检查配置状态
const checkConfigStatus = async () => {
  try {
    const response = await getConfigStatus()
    if (response.code === 200) {
      sessionTimeout.value = parseInt(response.data.sessionTimeout) || 7200
    }
  } catch (error) {
    console.error('获取配置状态失败:', error)
    ElMessage.error('获取配置状态失败')
  }
}

const goBack = () => {
  router.push('/system')
}

onMounted(() => {
  checkConfigStatus()
})
</script>

<style scoped>
.login-log {
  padding: 20px;
}

.log-content {
  text-align: center;
  padding: 40px 0;
}

.log-content h3 {
  color: #409eff;
  margin-bottom: 20px;
}

.log-content p {
  color: #606266;
  margin-bottom: 30px;
}
</style>
